package com.unit_10;
import java.util.Random;
import java.util.Scanner;
public class Demo03{
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int index;
        Random r = new Random();
        int[]numbers = new int[100];
        for(int i = 0; i < numbers.length;i++){
            numbers[i] = r.nextInt();
            System.out.println(numbers[i]);
        }
        System.out.print("请输入一个下标值：");
        try{
            index = input.nextInt();
            System.out.println(numbers[index]);
        }catch(IndexOutOfBoundsException oe){
            System.out.println("下标越界");
        }
    }
}